/**
 * 
 */
package com.bagtrack.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


/**
 * @author Brian Boyle
 * Nov 13, 2011
 *
 */
@Entity
@Table(name = "WAYPOINT")
public class Waypoint {

    private Long id;
    private Double longitude;
    private Double latitude;
    private Route route;

    /**
     * @param longitude
     * @param latitude
     */
    public Waypoint(Double longitude, Double latitude) {
        this.longitude = longitude;
        this.latitude = latitude;
    }

    /**
     * Default Constructor
     */
    public Waypoint() {

    }


    /**
     * @return the id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    public Long getId() {
        return id;
    }


    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }


    /**
     * @return the longitude
     */
    @Column(name = "LONGITUDE")
    public Double getLongitude() {
        return longitude;
    }


    /**
     * @param longitude the longitude to set
     */
    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }


    /**
     * @return the latitude
     */
    @Column(name = "LATITUDE")
    public Double getLatitude() {
        return latitude;
    }


    /**
     * @param latitude the latitude to set
     */
    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }


    /**
     * @return the route
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ROUTE_ID")
    public Route getRoute() {
        return route;
    }


    /**
     * @param route the route to set
     */
    public void setRoute(Route route) {
        this.route = route;
    }


    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "Waypoint [id=" + id + ", longitude=" + longitude + ", latitude=" + latitude + "]";
    }

}
